home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 October / EnigmA AMIGA RUN 22 (1997)(G.R. Edizioni)(IT)[!][issue 1997-10 & 11][EAR-CD VI].iso / earcd / util1 / dover.lha / DoVer / src / GetResidentID.asm < prev    next >
Assembly Source File  |  1995-11-26  |  971b  |  47 lines

  1.  
  2.     INCDIR    Includes:
  3.     INCLUDE    exec/resident.i
  4.  
  5. *********************************************************************
  6. *    IN:    e.BPTR    A0 first segment
  7. *    OUT:    e.APTR    D0 start of verstring
  8.  
  9.     XDEF    _GetResidentID
  10.  
  11. _GetResidentID    move.l    (a7)+,(a7)    ;because Oberon 3.11 pushes any senseless waste
  12.         moveq    #0,d0                ;return 0 if no match
  13.     
  14. .seg        adda.l    a0,a0                ;BPTR -> APTR
  15.         adda.l    a0,a0
  16.         move.l    (-4,a0),d1            ;D1 size of segment
  17.         move.l    (a0)+,a1            ;A1 BPTR to next segment
  18.     
  19.         subq.l    #8,d1
  20.         lsr.l    #1,d1                ;because WORDs
  21.         subq.l    #1,d1                ;because DBcc
  22. .lp        cmpi.w    #RTC_MATCHWORD,(a0)+
  23.         dbeq    d1,.lp
  24.         beq    .found
  25.  
  26. .next        addq.w    #1,d1                ;hunks > 128k
  27.         subq.l    #1,d1
  28.         bcc    .lp
  29.  
  30.         move.l    a1,a0
  31.         move.l    a0,d1
  32.         bne    .seg
  33.         rts
  34.  
  35. .found        subq.w    #1,d1                ;because DBcc
  36.         blo    .next
  37.         subq.l    #2,a0
  38.         cmp.l    (RT_MATCHTAG,a0),a0
  39.         addq.l    #2,a0
  40.         bne    .lp
  41.         move.l    (RT_IDSTRING-2,a0),d0        ;D0 = APTR verstring
  42.         rts
  43.  
  44. *********************************************************************
  45.  
  46.     END
  47.